package mysql

import (
	"gorm.io/gorm"
	"week3/models/global"
	"week3/models/request"
)

type UserLog struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);comment:账号;"`
	Password string `gorm:"type:varchar(32);comment:密码;"`
}

// 登录查询
func LoginUser(data request.UserRequest) UserLog {
	var user UserLog
	global.DB.Where("username = ?", data.Username).
		Where("password = ?", data.Password).First(&user)
	return user
}
